@extends('template.adminpage')
@section('content')
    <script src="{{URL::to('/js/jquery-2.1.1.min.js')}}"></script>

    <script>
    $(document).ready(function(){
      $("#hide").click(function(){
        $("#p").hide();
      });
      $("#show").click(function(){
        $("#p").show();
      });
    });

     $(document).ready(function(){
      $("#hide2").click(function(){
        $("#p2").hide();
      });
      $("#show2").click(function(){
        $("#p2").show();
      });
    });

     $(document).ready(function(){
      $("#hide3").click(function(){
        $("#p3").hide();
      });
      $("#show3").click(function(){
        $("#p3").show();
      });
    });

     $(document).ready(function(){
      $("#hide4").click(function(){
        $("#p4").hide();
      });
      $("#show4").click(function(){
        $("#p4").show();
      });
    });
    </script>

    
<ol class="breadcrumb">
  <li class="active">Pesan produk</li>
</ol>

<div class="container-black">
  <br>
    <div class="row" style="margin-bottom:175px">
      <div class="col-lg-2 col-lg-offset-1">
        <div class="panel panel-dark">
         <div class="panel-heading">
            <h2 class="panel-title" align="center">Brosur</h2>
          </div>
          <div class="panel-body">
          <p align="center"><img id="img" src="{{URL::to('images/icon_marketting-kit.jpg')}}" /><br><br>
           <a data-toggle="modal" data-target="#orderbrosur"><button class="btn btn-dark" style="width:125px">Pesan</button></a></p>  
          </div> 
        </div>
      </div>

      <div class="col-lg-2">
        <div class="panel panel-dark">
          <div class="panel-heading">
            <h2 class="panel-title" align="center">ID Card</h2>
          </div>
          <div class="panel-body">
          <p align="center"><img id="img" src="{{URL::to('images/icon_kartu.jpg')}}" /></br></br>
          <a data-toggle="modal" data-target="#orderidcard"><button class="btn btn-dark" style="width:125px">Pesan</button></a></p>     
          </div>                
        </div>
      </div>

      <div class="col-lg-2">
        <div class="panel panel-dark">
          <div class="panel-heading">
            <h2 class="panel-title" align="center">Packaging</h2>
          </div>
          <div class="panel-body">
          <p align="center"><img id="img" src="{{URL::to('images/icon_packaging.jpg')}}" /></br></br>
           <a data-toggle="modal" data-target="#orderpackaging"><button class="btn btn-dark" style="width:125px">Pesan</button></a></p>  
          </div>                
        </div>
      </div>

      <div class="col-lg-2">
        <div class="panel panel-dark">
          <div class="panel-heading">
            <h2 class="panel-title" align="center">Kaos</h2>
          </div>
          <div class="panel-body">
          <p align="center"><img id="img" src="{{URL::to('images/tshirt_product.png')}}" /></br></br>
          <a data-toggle="modal" data-target="#ordertshirt"><button class="btn btn-dark" style="width:125px">Pesan</button></a> </p> 
          </div>                
        </div>
      </div>

      <div class="col-lg-2">
        <div class="panel panel-dark">
           <div class="panel-heading">
            <h2 class="panel-title" align="center">Nota</h2>
          </div>
          <div class="panel-body">
          <p align="center"><img id="img" src="{{URL::to('images/nota_product.png')}}" /></br></br>
          <a data-toggle="modal" data-target="#ordernota"><button class="btn btn-dark" style="width:125px">Pesan</button></a> </p> 
          </div>                
        </div>
      </div>
    </div> 
</div> 

<!-- modal -->
<div class="modal fade" id="orderbrosur" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
  <div class="modal-dialog modal-lg" style="width:95%">
    <div class="modal-content">
      <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="margin-right:5px">&times;</button>

      <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:5px">Pesan Brosur</label></h4>
      </div>
     <div align="left">
     <br>
      {{Form::open(array(
            'url' => '/pesanproduk/pesanbrosur',
            'method' => 'POST'
          ))}}
      <div class="row">
      <div class="col-md-5 col-md-offset-1">
         <b id="titlelabel"><label>Data Brosur</label></b> 
        <legend></legend>
            <div class="row">
                  <div class="col-lg-5">
                  Jenis cetak (Type) <font color="red">*</font>
                  </div>
                  <div class="col-lg-6">
                  <table>
                  <td>
                    <select class="form-control"  name="jenis_cetak" id="jenis_cetak" style="width:250px;height:30px" required >
                      <option value="" id="">Silahkan pilih</option>
                      <option value="brochure" id="brochure">Brosur</option>
                      <option value="envelope" id="envelope">Amplop</option>
                      <option value="letterhead" id="letterhead">Kop surat</option>
                      <option value="flayer" id="flayer">Flayer</option>
                    </select>
                  </td>
                  <td>
                      {{$errors->first('jenis_brosur')}}
                  </td>
                </table><br>
                    </div>
                  </div>

                  <div class="row">
                  <div class="col-lg-5">
                  Ukuran (Size) <font color="red">*</font>
                  </div>
                  <div class="col-lg-6">
                  <table>
                  <td>
                    <select class="form-control"  name="brosur_size" id="brosur_size" style="width:250px;height:30px" required >
                      <option value="">Silahkan pilih</option>
                      @foreach($brosursize as $bsize)
                        <option value="{{$bsize->size_brochure_size_id}}" id="brosur{{$bsize->size_brochure_size_id}}">{{$bsize->size_brochure_name}}</option>
                      @endforeach
                      @foreach($letterheadsize as $lsize)
                        <option value="{{$lsize->size_letterhead_size_id}}" id="letterhead{{$lsize->size_letterhead_size_id}}">{{$lsize->size_letterhead_name}}</option>
                      @endforeach
                      @foreach($flayersize as $fsize)
                        <option value="{{$fsize->size_flayer_size_id}}" id="flayer{{$fsize->size_flayer_size_id}}">{{$fsize->size_flayer_length.' x '.$fsize->size_flayer_width.' '.$fsize->size_flayer_unit}}</option>
                      @endforeach
                      @foreach($envelopesize as $esize)
                        <option value="{{$esize->size_envelope_size_id}}" id="envelope{{$esize->size_envelope_size_id}}">{{$esize->size_envelope_length.' x '.$esize->size_envelope_width.' '.$esize->size_envelope_unit}}</option>
                      @endforeach

                    </select>
                  </td>
                  <td>
                    {{$errors->first('kualitas_brosur')}}
                  </td>
                </table>
                  <br>
                    </div>
                  </div>


                  <div class="row">
                  <div class="col-lg-5">
                  Jenis kertas <font color="red">*</font>
                  </div>
                  <div class="col-lg-6">
                  <table>
                  <td>
                    <select class="form-control"  name="jenis_kertas" id="jenis_kertas"  style="width:250px;height:30px" required>
                      <option value="">Silahkan pilih</option>
                      @foreach($brosurkertas as $bkertas)
                        <option value="{{$bkertas->papertype_id}}" id="brosurkertas{{$bkertas->papertype_id}}">{{$bkertas->papertype_name}}</option>
                      @endforeach
                      @foreach($letterheadkertas as $lkertas)
                        <option value="{{$lkertas->papertype_id}}" id="letterheadkertas{{$lkertas->papertype_id}}">{{$lkertas->papertype_name}}</option>
                      @endforeach
                      @foreach($flayerkertas as $fkertas)
                        <option value="{{$fkertas->papertype_id}}" id="flayerkertas{{$fkertas->papertype_id}}">{{$fkertas->papertype_name}}</option>
                      @endforeach
                      @foreach($envelopekertas as $ekertas)
                        <option value="{{$ekertas->papertype_id}}" id="envelopekertas{{$ekertas->papertype_id}}">{{$ekertas->papertype_name}}</option>
                      @endforeach
                    </select>
                  </td>
                  <td>
                    {{$errors->first('kualitas_brosur')}}
                  </td>
                </table>
                  <br>
                    </div>
                  </div>

                  <div class="row">
                  <div class="col-lg-5">
                    Warna <font color="red">*</font>
                    </div>
                  <div class="col-lg-7">
                  <?php
                      if(Input::Old('warna')<>""){
                        $jk = Input::Old('warna');
                        }else{
                        $jk = Session::get('warna');
                        }
                  ?>
                    <div class="row">
                    <div class="col-lg-5 ">
                <input type="radio" name="warna" id="warna" value="Warna" <?php if($jk=='Warna'){echo "checked";} ?>required> Warna</input>  
                    </div>
                    <div class="col-lg-6 ">
                <input type="radio" name="warna" id="warna" value="Hitam putih" <?php if($jk=='Hitam putih'){echo "checked";} ?>required> Hitam putih</input>
                      </div>
                      </div>
                    </div>
                    </div>
                    <br>{{$errors->first('warna')}}



                  <div class="row">
                  <div class="col-lg-5">
                  Halaman cetak (Qty)<font color="red">*</font>
                  </div>
                  <div class="col-lg-6">
                  <table>
                  <td>
                    <select class="form-control" id="qty_print_page" name="qty_print_page" style="width:250px;height:30px" required >
                      <option value="">Silahkan pilih</option>
                      <option value="1/2">1/2</option>
                                      <option value="1">1</option>
                                      <option value="1 1/2">1 1/2</option>
                                      <option value="2">2</option>
                    </select>
                  </td>
                  <td>
                    {{$errors->first('kualitas_brosur')}}
                  </td>
                </table>
                  <br>
                    </div>
                  </div>

                  <div class="row">
                  <div class="col-lg-5">
                 Design<br>
                 (Format *ai, *psd, *jpg, *png, *cdr, max 5MB)

                  </div>
                  <div class="col-lg-7">
                    <input type="file" class="form-control" id="i_file1"  name="design_brosur" style="width:250px;height:30px" />
                    <br>
                    </div>
                  </div>

                  <div class="row">
                  <div class="col-lg-5">
                 Jumlah order <font color="red">*</font>
                  </div>
                  <div class="col-lg-6">
                    <div class="row">
                    <div class="col-lg-6 ">
                <input class="form-control" type="number" min="1" id="order_brosur_qty" name="order_brosur_qty" style="width:110px;height:30px" required ></input>  
                    </div>
                    <div class="col-lg-6 ">
                 <select  class="form-control"  name="order_brosur_qty_unit" style="width:110px;height:30px" required>
                                        <option value="Rim">Rim</option>
                                        <option value="Pcs">Pcs</option>
                                      </select>
                      </div>
                      </div>
                    </div>
                  </div>



          </div>


           <div class="col-md-5">
             <b id="titlelabel"><label>Perkiraan total biaya</label></b> 
            <legend></legend>
                <div class="row">
                      <div class="col-lg-5">
                    Total biaya
                      </div>
                      <div class="col-lg-6">
                        <span id="span_brosur_price">Rp 0</span>
                      </div>
                  </div>
            </div>
            <br>
            <br>
            <br>
            <br><br>



          <div class="col-md-5">
             <b id="titlelabel"><label>Data Pemesan</label></b> 
            <legend></legend>
                <div class="row">
                      <div class="col-lg-5">
                    Nama pemesan <font color="red">*</font>
                      </div>
                      <div class="col-lg-6">
                      <?php if(Input::Old('nama')<>""){
                            $value = Input::Old('nama');
                            }else{
                            $value = Session::get('nama');
                            }
                      ?>
                        <input type="text"  class="form-control"  name="nama" placeholder="Nama"style="width:250px;height:30px" value="{{$value}}" required /></input>{{$errors->first('nama')}}
                        </div>
                      </div><br>
                      <div class="row">
                      <div class="col-lg-5">
                  Email <font color="red">*</font>
                  </div>
                      <div class="col-lg-6">
                      <?php if(Input::Old('email')<>""){
                            $value = Input::Old('email');
                            }else{
                            $value = Session::get('email');
                            }
                      ?>
                        <input type="text" class="form-control"  name="email" placeholder="Email"style="width:250px;height:30px" value="{{$value}}" required/></input>{{$errors->first('email')}}
                      </div>
                      </div><br>

                        <div class="row">
                      <div class="col-lg-5">
                        Jenis kelamin <font color="red">*</font>
                        </div>
                      <div class="col-lg-6">
                      <?php
                          if(Input::Old('jenis_kelamin')<>""){
                            $jk = Input::Old('jenis_kelamin');
                            }else{
                            $jk = Session::get('jenis_kelamin');
                            }
                      ?>
                  <input type="radio" name="jenis_kelamin" value="Laki-laki" <?php if($jk=='Laki-laki'){echo "checked";} ?> required> Laki-laki</input> <input type="radio" name="jenis_kelamin" value="Perempuan" <?php if($jk=='Perempuan'){echo "checked";} ?> required> Perempuan</input><br>{{$errors->first('jenis_kelamin')}}
                        </div>
                        </div>

                        
                      <br>

                        <div class="row">
                      <div class="col-lg-5">
                        Alamat <font color="red">*</font>
                        </div>
                      <div class="col-lg-6">
                      <?php if(Input::Old('alamat')<>""){
                            $value = Input::Old('alamat');
                            }else{
                            $value = Session::get('alamat');
                            }
                      ?>
                        <textarea class="form-control"  name="alamat" placeholder="Alamat"style="width:250px;height:50px" required>{{$value}}</textarea>{{$errors->first('alamat')}}
                
                        </div>
                        </div>

                      <br>

                        <div class="row">
                      <div class="col-lg-5">
                        No Telepon (kontak) <font color="red">*</font>
                        </div>
                      <div class="col-lg-6">
                      <?php if(Input::Old('kontak')<>""){
                            $value = Input::Old('kontak');
                            }else{
                            $value = Session::get('kontak');
                            }
                      ?>
                  <input type="text" class="form-control"  name="kontak" placeholder="No telepon" style="width:250px;height:30px" value="{{$value}}" required />{{$errors->first('kontak')}}<br>
                        </div>
                        </div>
                    
        <b id="titlelabel"><label>Referensi</label></b>
        <legend></legend>
          <div class="row">
          <div class="col-lg-5">
            Marketing ID (Kode)
          </div>
          <div class="col-lg-6">
            <select class="form-control"  name="marketing_id" style="width:250px;height:30px" required />
              <option value="1">MR-SCI-0001</option>
              <option value="2">MR-SCI-0002</option>
            </select>
          </div>
          </div>



        <br>
      </div>
      </div>

         

     </div>


      <div class="modal-footer">


<button type="submit" class="btn btn-dark pull-right" id="i_submit1" onclick="get_brosur_price();"  style="width:125px">Simpan</button>{{Form::close()}} <button class="btn btn-dark pull-right" style="width:125px; margin-right:5px" class="close" data-dismiss="modal">Batal</button></a><button class="btn btn-dark" id="cek" style="width:125px" onclick="get_brosur_price();" >Cek harga</button>
           
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">
function get_brosur_price() {
  var jenis_cetak = $("#jenis_cetak").val();
  var qty_print_page = $("#qty_print_page").val(); //ini ambil darimana
  var jenis_kertas = $("#jenis_kertas").val();
  var brosur_size = $("#brosur_size").val();
  var warna = $("#warna").val(); //blm ada id-nya
  var jumlah_order = $("#order_brosur_qty").val(); //blm ada id-nya
    //if(parseInt(jumlah_order).length > 0) {
  // console.log('12312');
        $.ajax({
            type: 'POST',
            url: "{{URL::to('/pesanproduk/get_brosur_price')}}",
            data: 'jenis_cetak=' + jenis_cetak + 
                  '&qty_print_page=' + qty_print_page + 
                  '&jenis_kertas=' + jenis_kertas + 
                  '&brosur_size=' + brosur_size + 
                  '&warna=' + warna + 
                  '&jumlah_order=' + jumlah_order,
            dataType: 'json',
            async: false,
            success: function(product_price) {
                $("#span_brosur_price").html(product_price);
            }
        });
    //}
}

</script>

<!-- IDCARD -->
<!-- IDCARD -->
<!-- IDCARD -->
<!-- IDCARD -->




<div class="modal fade" id="orderidcard" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
  <div class="modal-dialog modal-lg" style="width:95%">
    <div class="modal-content">
      <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="margin-right:5px">&times;</button>

      <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:5px">Pesan ID Card</label></h4>
      </div>
     <div align="left">
     <br>
      {{Form::open(array(
            'url' => '/pesanproduk/pesanidcard',
            'method' => 'POST'
          ))}}
      <div class="row">
      <div class="col-md-5 col-md-offset-1">
         <b id="titlelabel"><label>Data ID Card</label></b> 
        <legend></legend>
                  <div class="row">
                  <div class="col-lg-5">
                  <label>Jenis ID Card (Type) <font color="red">*</font></label>
                  </div>
                  <div class="col-lg-7">
                  <table>
                  <td>
                    <select class="form-control" id="jenis_idcard" name="jenis_idcard" style="width:250px;height:30px" required>
                      <option value="">Silahkan pilih</option>
                      <?php 
                        if(Input::Old('jenis_idcard')<>""){
                        $id = Input::Old('jenis_idcard');
                        }else{
                        $id = Session::get('jenis_idcard');
                        }
                  foreach($jenisidcard as $jns){
                    if($jns->idcard_type_id == $id){
                      echo '<option value="'.$jns->idcard_type_id.'" selected>'.$jns->idcard_type_name.'</option>';
                    }else{
                      echo '<option value="'.$jns->idcard_type_id.'">'.$jns->idcard_type_name.'</option>';
                    }
                  }
                        ?>
                    </select>
                  </td>
                  <td>
                      {{$errors->first('jenis_idcard')}}
                  </td>
                </table><br>
                    </div>
                  </div>

                  <div class="row">
                  <div class="col-lg-5">
                  <label>Kualitas ID Card <font color="red">*</font></label>
                  </div>
                  <div class="col-lg-7">
                  <table>
                  <td>
                    <select class="form-control" id="kualitas_idcard" name="kualitas_idcard" style="width:250px;height:30px" required>
                      <option value="">Silahkan pilih</option>
                      <?php 
                        if(Input::Old('kualitas_idcard')<>""){
                        $id = Input::Old('kualitas_idcard');
                        }else{
                        $id = Session::get('kualitas_idcard');
                        }

                  foreach($kualitasidcard as $kualitas){
                    if($kualitas->idcard_quality_id == $id){
                      echo '<option value="'.$kualitas->idcard_quality_id.'" selected>'.$kualitas->idcard_quality_name.'</option>';
                    }else{
                      echo '<option value="'.$kualitas->idcard_quality_id.'">'.$kualitas->idcard_quality_name.'</option>';
                    }
                  }
                        ?>
                    </select>
                  </td>
                  <td>
                    {{$errors->first('kualitas_idcard')}}
                  </td>
                </table>
                  <br>
                    </div>
                  </div>

                  <div class="row">
                  <div class="col-lg-5">
                   Design<br>
                 (Format *ai, *psd, *jpg, *png, *cdr, max 5MB)
                  </div>
                  <div class="col-lg-7">
                    <input type="file" class="form-control" id="i_file2" name="design_idcard" style="width:250px;height:30px"/>
                    <br>
                    </div>
                  </div>

                  <div class="row">
                  <div class="col-lg-5">
                  <label>Jumlah order <font color="red">*</font></label>
                  </div>
                  <div class="col-lg-7">
                  <?php 
                      if(Input::Old('pilihan_jumlah')<>""){
                        $pilihan_jumlah = Input::Old('pilihan_jumlah');
                        }else{
                        $pilihan_jumlah = Session::get('pilihan_jumlah');
                        }

                        if(Input::Old('jumlah_idcard')<>""){
                        $jumlah_idcard = Input::Old('jumlah_idcard');
                        }else{
                        $jumlah_idcard = Session::get('jumlah_idcard');
                        }
                   ?>
                    <input type="radio" name="pilihan_jumlah" value="0" id="hide" <?php if($pilihan_jumlah=='0'){echo "checked";} ?> checked /> 10 Kartu / Pcs (Minimal Order)   {{$errors->first('pilihan_jumlah')}}<br><br>
                    <table>
                      <td>
                        <input type="radio" name="pilihan_jumlah" value="1" id="show" <?php if($pilihan_jumlah=='1'){echo "checked";} ?> />  Custom Jumlah 
                      </td>
                      <td>
                        <b id="p"  <?php if($pilihan_jumlah=='1'){echo "style='display:block'";}else{echo "style='display:none'";} ?>><input type="number" min="10" value="10" id="jumlah_idcard" name="jumlah_idcard" style="width:100px;height:30px" value="{{$jumlah_idcard}}" /><br><strong> Kartu / Pcs </strong></b>
                      </td>
                    <td>{{$errors->first('jumlah_idcard')}}</td></table>
                    <br><br>
                    </div>
                  </div>
      <b id="titlelabel"><label>Fitur tambahan</label></b> 
        <legend></legend>


        <div class="row">
       <?php $ref = DB::table('ref_additional_features')
              ->where('additional_features_type','ID Card')
              ->get();
        ?>
            @foreach($ref as $ref)
            <div class="col-md-6">
            <input type="checkbox" class="from-control fitur_tambahan" id="fitur{{$ref->additional_features_id}}" name="{{$ref->additional_features_id}}" value="1"<?php if(Session::get($ref->additional_features_name)=='1'){echo "checked";} ?>> {{$ref->additional_features_name}} Rp {{$ref->additional_features_price}} / {{$ref->additional_features_unit}}</input><br><br>
          </div>
            @endforeach

        </div>



      </div>

         <div class="col-md-5">
             <b id="titlelabel"><label>Perkiraan total biaya</label></b> 
            <legend></legend>
                <div class="row">
                      <div class="col-lg-5">
                    Total biaya
                      </div>
                      <div class="col-lg-6">
                        <span id="span_idcard_price">Rp 0</span>
                      </div>
                  </div>
            </div>
            <br>
            <br>
            <br>
            <br><br>


      <div class="col-md-5">
         <b id="titlelabel"><label>Data Pemesan</label></b> 
        <legend></legend>
            <div class="row">
                  <div class="col-lg-5">
                Nama pemesan <font color="red">*</font>
                  </div>
                  <div class="col-lg-6">
                  <?php if(Input::Old('nama')<>""){
                        $value = Input::Old('nama');
                        }else{
                        $value = Session::get('nama');
                        }
                  ?>
                    <input type="text"  class="form-control"  name="nama" placeholder="Nama"style="width:250px;height:30px" value="{{$value}}"required /></input>{{$errors->first('nama')}}
                    </div>
                  </div><br>
                  <div class="row">
                  <div class="col-lg-5">
              Email <font color="red">*</font>
              </div>
                  <div class="col-lg-6">
                  <?php if(Input::Old('email')<>""){
                        $value = Input::Old('email');
                        }else{
                        $value = Session::get('email');
                        }
                  ?>
                    <input type="text" class="form-control"  name="email" placeholder="Email"style="width:250px;height:30px" value="{{$value}}"required/></input>{{$errors->first('email')}}
                  </div>
                  </div><br>

                    <div class="row">
                  <div class="col-lg-5">
                    Jenis kelamin <font color="red">*</font>
                    </div>
                  <div class="col-lg-6">
                  <?php
                      if(Input::Old('jenis_kelamin')<>""){
                        $jk = Input::Old('jenis_kelamin');
                        }else{
                        $jk = Session::get('jenis_kelamin');
                        }
                  ?>
              <input type="radio" name="jenis_kelamin" value="Laki-laki" <?php if($jk=='Laki-laki'){echo "checked";} ?>required> Laki-laki</input> <input type="radio" name="jenis_kelamin" value="Perempuan" <?php if($jk=='Perempuan'){echo "checked";} ?>required> Perempuan</input><br>{{$errors->first('jenis_kelamin')}}
                    </div>
                    </div>

                    
                  <br>

                    <div class="row">
                  <div class="col-lg-5">
                    Alamat <font color="red">*</font>
                    </div>
                  <div class="col-lg-6">
                  <?php if(Input::Old('alamat')<>""){
                        $value = Input::Old('alamat');
                        }else{
                        $value = Session::get('alamat');
                        }
                  ?>
                    <textarea class="form-control"  name="alamat" placeholder="Alamat"style="width:250px;height:50px" required>{{$value}}</textarea>{{$errors->first('alamat')}}
            
                    </div>
                    </div>

                  <br>

                    <div class="row">
                  <div class="col-lg-5">
                    No Telepon (kontak) <font color="red">*</font>
                    </div>
                  <div class="col-lg-6">
                  <?php if(Input::Old('kontak')<>""){
                        $value = Input::Old('kontak');
                        }else{
                        $value = Session::get('kontak');
                        }
                  ?>
              <input type="text" class="form-control"  name="kontak" placeholder="No telepon" style="width:250px;height:30px" value="{{$value}}" required/>{{$errors->first('kontak')}}<br>
                    </div>
                    </div>
                    
        <b id="titlelabel"><label>Referensi</label></b>
        <legend></legend>
          <div class="row">
          <div class="col-lg-5">
            Marketing ID (Kode)
          </div>
          <div class="col-lg-6">
            <select class="form-control"  name="marketing_id" style="width:250px;height:30px" required/>
              <option value="1">MR-SCI-0001</option>
              <option value="2">MR-SCI-0002</option>
            </select>
          </div>
          </div>

        <br>
      </div>
      </div>

     </div>


      <div class="modal-footer">

<button type="submit" onclick="get_idcard_price();" id="i_submit2" class="btn btn-dark pull-right" style="width:125px">Simpan</button>{{Form::close()}} <button class="btn btn-dark pull-right" style="width:125px; margin-right:5px" class="close" data-dismiss="modal">Batal</button></a><button class="btn btn-dark" id="cek" style="width:125px" onclick="get_idcard_price();" >Cek harga</button>
           
      </div>
    </div>
  </div>
</div>

 <?php $reff = DB::table('ref_additional_features')
              ->where('additional_features_type','ID Card')
              ->get();
        ?>

<script type="text/javascript">
   
function get_idcard_price() {
  var jenis_idcard = $("#jenis_idcard").val();
  var kualitas_idcard = $("#kualitas_idcard").val(); 
  var jumlah_idcard = $("#jumlah_idcard").val();
  var arr_fitur_tambahan = {};
  if($('input:checkbox.fitur_tambahan').length > 0) {
    $('input:checkbox.fitur_tambahan').each(function () {
      var item_id = $(this).attr('id');
      var item_name = $(this).attr('name');
  var item_value = (this.checked ? $(this).val() : "");
      
      arr_fitur_tambahan[item_id] = {
        'id': item_name, 
        'value': item_value
      };
    });
}
        $.ajax({
            type: 'POST',
            url: "{{URL::to('/pesanproduk/get_idcard_price')}}",
            data: 'jenis_idcard=' + jenis_idcard + 
                  '&kualitas_idcard=' + kualitas_idcard + 
                  '&jumlah_idcard=' + jumlah_idcard + 
                  '&arr_fitur_tambahan=' + JSON.stringify(arr_fitur_tambahan),
            dataType: 'json',
            async: false,
            success: function(product_price) {
                $("#span_idcard_price").html(product_price);
            }
        });
    //}
}
</script>



<div class="modal fade" id="ordernota" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
  <div class="modal-dialog modal-lg" style="width:95%">
    <div class="modal-content">
      <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="margin-right:5px">&times;</button>

      <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:5px">Pesan Nota</label></h4>
      </div>
     <div align="left">
     <br>
      {{Form::open(array(
            'url' => '/pesanproduk/pesannota',
            'method' => 'POST'
          ))}}
      <div class="row">
      <div class="col-md-5 col-md-offset-1">
         <b id="titlelabel"><label>Data Nota</label></b> 
        <legend></legend>
                 <div class="row">
                  <div class="col-lg-5">

                  Jenis cetak (Type) 
                  </div>
                  <div class="col-lg-7">
                  <table>
                  <td>
                    <select class="form-control" id="jenis_nota" name="jenis_nota" style="width:250px;height:30px" required>
                      <option value="">Silahkan pilih</option>
                      <?php 
                        if(Input::Old('jenis_nota')<>""){
                        $jenis_nota = Input::Old('jenis_nota');
                        }else{
                        $jenis_nota = Session::get('jenis_nota');
                        }
                  foreach($jenisnota as $nota){
                    if($nota->bill_id == $jenis_nota){
                      echo '<option value="'.$nota->bill_id.'" selected>'.$nota->bill_name.'</option>';
                    }else{
                      echo '<option value="'.$nota->bill_id.'">'.$nota->bill_name.'</option>';
                    }
                  }
                        ?>
                    </select>
                  </td>
                  <td>
                    {{$errors->first('jenis_nota')}}
                  </td>
                </table>
                  <br>
                    </div>
                  </div>

                  <div class="row">
                  <div class="col-lg-5">
                 Jenis kertas 
                  </div>
                  <div class="col-lg-7">
                  <table>
                  <td>
                    <select class="form-control" id="jenis_kertas_nota" name="jenis_kertas" style="width:250px;height:30px" required>
                      <option value="">Silahkan pilih</option>
                      <?php 
                        if(Input::Old('jenis_kertas')<>""){
                        $jeniskertas = Input::Old('jenis_kertas');
                        }else{
                        $jeniskertas = Session::get('jenis_kertas');
                        }
                  foreach($kertasnota as $paper){
                    if($paper->papertype_name == $jeniskertas){
                      echo '<option value="'.$paper->papertype_id.'" selected>'.$paper->papertype_name.'</option>';
                    }else{
                      echo '<option value="'.$paper->papertype_id.'">'.$paper->papertype_name.'</option>';
                    }
                  }
                        ?>
                    </select>
                  </td>
                  <td>
                    {{$errors->first('jenis_kertas')}}
                  </td>
                </table>
                  <br>
                    </div>
                  </div>

                  <div class="row">
                  <div class="col-lg-5">
                  Warna (Qty) <font color="red">*</font>
                  </div>
                  <div class="col-lg-7">
                    <input type="number" min="1" class="form-control" id="jumlah_warna" name="jumlah_warna" style="width:100px;height:30px" required />
                    <br>
                    </div>
                  </div>

                  <div class="row">
                  <div class="col-lg-5">
                   Design<br>
                 (Format *ai, *psd, *jpg, *png, *cdr, max 5MB)
                  </div>
                  <div class="col-lg-7">
                    <input type="file" class="form-control" id="i_file3" name="design_nota" style="width:250px;height:30px" />
                    <br>
                    </div>
                  </div>

                  <div class="row">
                  <div class="col-lg-5">
                  Jumlah order <font color="red">*</font>
                  </div>
                  <div class="col-lg-7">
                  
                        <input type="number" min="1" id="order_nota_qty"  name="jumlah_order" style="width:100px;height:30px" required /><strong> Rim</strong>
                    
                    <br><br>
                    </div>
                  </div>
     



      </div>


         <div class="col-md-5">
             <b id="titlelabel"><label>Perkiraan total biaya</label></b> 
            <legend></legend>
                <div class="row">
                      <div class="col-lg-5">
                    Total biaya
                      </div>
                      <div class="col-lg-6">
                        <span id="span_nota_price">Rp 0</span>
                      </div>
                  </div>
            </div>
            <br>
            <br>
            <br>
            <br><br>


      <div class="col-md-5">
         <b id="titlelabel"><label>Data Pemesan</label></b> 
        <legend></legend>
            <div class="row">
                  <div class="col-lg-5">
                Nama pemesan <font color="red">*</font>
                  </div>
                  <div class="col-lg-6">
                  <?php if(Input::Old('nama')<>""){
                        $value = Input::Old('nama');
                        }else{
                        $value = Session::get('nama');
                        }
                  ?>
                    <input type="text"  class="form-control"  name="nama" placeholder="Nama"style="width:250px;height:30px" value="{{$value}}"  required/></input>{{$errors->first('nama')}}
                    </div>
                  </div><br>
                  <div class="row">
                  <div class="col-lg-5">
              Email <font color="red">*</font>
              </div>
                  <div class="col-lg-6">
                  <?php if(Input::Old('email')<>""){
                        $value = Input::Old('email');
                        }else{
                        $value = Session::get('email');
                        }
                  ?>
                    <input type="text" class="form-control"  name="email" placeholder="Email"style="width:250px;height:30px" value="{{$value}}" required/></input>{{$errors->first('email')}}
                  </div>
                  </div><br>

                    <div class="row">
                  <div class="col-lg-5">
                    Jenis kelamin <font color="red">*</font>
                    </div>
                  <div class="col-lg-6">
                  <?php
                      if(Input::Old('jenis_kelamin')<>""){
                        $jk = Input::Old('jenis_kelamin');
                        }else{
                        $jk = Session::get('jenis_kelamin');
                        }
                  ?>
              <input type="radio" name="jenis_kelamin" value="Laki-laki" <?php if($jk=='Laki-laki'){echo "checked";} ?> required> Laki-laki</input> <input type="radio" name="jenis_kelamin" value="Perempuan" <?php if($jk=='Perempuan'){echo "checked";} ?> required> Perempuan</input><br>{{$errors->first('jenis_kelamin')}}
                    </div>
                    </div>

                    
                  <br>

                    <div class="row">
                  <div class="col-lg-5">
                    Alamat <font color="red">*</font>
                    </div>
                  <div class="col-lg-6">
                  <?php if(Input::Old('alamat')<>""){
                        $value = Input::Old('alamat');
                        }else{
                        $value = Session::get('alamat');
                        }
                  ?>
                    <textarea class="form-control"  name="alamat" placeholder="Alamat"style="width:250px;height:50px" required>{{$value}}</textarea>{{$errors->first('alamat')}}
            
                    </div>
                    </div>

                  <br>

                    <div class="row">
                  <div class="col-lg-5">
                    No Telepon (kontak) <font color="red">*</font>
                    </div>
                  <div class="col-lg-6">
                  <?php if(Input::Old('kontak')<>""){
                        $value = Input::Old('kontak');
                        }else{
                        $value = Session::get('kontak');
                        }
                  ?>
              <input type="text" class="form-control"  name="kontak" placeholder="No telepon" style="width:250px;height:30px" value="{{$value}}" required/>{{$errors->first('kontak')}}<br>
                    </div>
                    </div>
                    
        <b id="titlelabel"><label>Referensi</label></b>
        <legend></legend>
          <div class="row">
          <div class="col-lg-5">
            Marketing ID (Kode)
          </div>
          <div class="col-lg-6">
            <select class="form-control"  name="marketing_id" style="width:250px;height:30px" required/>
              <option value="1">MR-SCI-0001</option>
              <option value="2">MR-SCI-0002</option>
            </select>
          </div>
          </div>



        <br>
      </div>
      </div>

         

     </div>


      <div class="modal-footer">


<button type="submit" class="btn btn-dark pull-right" id="i_submit3" onclick="get_nota_price();" style="width:125px">Simpan</button>{{Form::close()}} <button class="btn btn-dark pull-right" style="width:125px; margin-right:5px" class="close" data-dismiss="modal">Batal</button></a><button class="btn btn-dark" id="cek" style="width:125px" onclick="get_nota_price();" >Cek harga</button>
           
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">
function get_nota_price() {
  var jenis_nota = $("#jenis_nota").val();
  var jenis_kertas_nota = $("#jenis_kertas_nota").val();
  var jumlah_warna = $("#jumlah_warna").val(); //blm ada id-nya
  var order_nota_qty = $("#order_nota_qty").val(); //blm ada id-nya
    //if(parseInt(jumlah_order).length > 0) {
  // console.log('12312');
        $.ajax({
            type: 'POST',
            url: "{{URL::to('/pesanproduk/get_nota_price')}}",
            data: 'jenis_nota=' + jenis_nota + 
                  '&jenis_kertas_nota=' + jenis_kertas_nota + 
                  '&jumlah_warna=' + jumlah_warna + 
                  '&order_nota_qty=' + order_nota_qty,
            dataType: 'json',
            async: false,
            success: function(product_price) {
                $("#span_nota_price").html(product_price);
            }
        });
    //}
}

</script>


<div class="modal fade" id="ordertshirt" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
  <div class="modal-dialog modal-lg" style="width:95%">
    <div class="modal-content">
      <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="margin-right:5px">&times;</button>

      <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:5px">Pesan T-Shirt</label></h4>
      </div>
     <div align="left">
     <br>
      {{Form::open(array(
            'url' => '/pesanproduk/pesantshirt',
            'method' => 'POST'
          ))}}
      <div class="row">
      <div class="col-md-5 col-md-offset-1">
         <b id="titlelabel"><label>Data T-Shirt</label></b> 
        <legend></legend>
                  <div class="row">
          <div class="col-lg-5">

                  Jenis cetak (Type) <font color="red">*</font>
                  </div>
                  <div class="col-lg-7">
                  <table>
                  <td>
                    <select class="form-control"  id="jenis_bahan_kaos" name="jenis_bahan_kaos" style="width:250px;height:30px" required>
                      <option value="">Silahkan pilih</option>
                      <?php 
                        if(Input::Old('jenis_bahan_kaos')<>""){
                        $jenis_bahan_kaos = Input::Old('jenis_bahan_kaos');
                        }else{
                        $jenis_bahan_kaos = Session::get('jenis_bahan_kaos');
                        }
                  foreach($jeniskaos as $jenisbahan){
                    if($jenisbahan->tshirt_id == $jenis_bahan_kaos){
                      echo '<option value="'.$jenisbahan->tshirt_id.'" selected>'.$jenisbahan->tshirt_type_of_material.'</option>';
                    }else{
                      echo '<option value="'.$jenisbahan->tshirt_id.'">'.$jenisbahan->tshirt_type_of_material.'</option>';
                    }
                  }
                        ?>
                    </select>
                  </td>
                  <td>
                    {{$errors->first('jenis_bahan_kaos')}}
                  </td>
                </table>
                  <br>
                    </div>
                  </div>

                  <div class="row">
                  <div class="col-lg-5">
                  Design<br>
                 (Format *ai, *psd, *jpg, *png, *cdr, max 5MB)
                  </div>
                  <div class="col-lg-7">
                    <input type="file" class="form-control" id="i_file4" name="design_kaos" style="width:250px;height:30px" />
                    <br>
                    </div>
                  </div>

                  <div class="row">
                  <div class="col-lg-5">
                 Jumlah order <font color="red">*</font>
                  </div>
                  <div class="col-lg-7">
                  <?php 
                      if(Input::Old('pilihan_jumlah_kaos')<>""){
                        $pilihan_jumlah_kaos = Input::Old('pilihan_jumlah_kaos');
                        }else{
                        $pilihan_jumlah_kaos = Session::get('pilihan_jumlah_kaos');
                        }

                        if(Input::Old('jumlah_custom')<>""){
                        $jumlah_custom = Input::Old('jumlah_custom');
                        }else{
                        $jumlah_custom = Session::get('jumlah_custom');
                        }

                        if(Input::Old('jumlah_standar')<>""){
                        $jumlah_standar = Input::Old('jumlah_standar');
                        }else{
                        $jumlah_standar = Session::get('jumlah_standar');
                        }
                   ?>
                    <input type="radio"  name="pilihan_jumlah_kaos" value="0" id="hide2" <?php if($pilihan_jumlah_kaos==''){echo "checked";} ?> checked  /> Standar (Default)   {{$errors->first('pilihan_jumlah')}}
                    <select  class="form-control" style="width:250px;height:30px" name="jumlah_standar_kaos" id="jumlah_standar_kaos" >
                        <option value="1">1 Dozen</option>
                        <option value="2">2 Dozen</option>
                        <option value="3">3 Dozen</option>
                        <option value="4">4 Dozen</option>
                        <option value="5">5 Dozen</option>
                        <option value="10">10 Dozen</option>
                    </select>
                    <br>
                    <table>
                    <td>
                      <input type="radio" name="pilihan_jumlah_kaos" value="1" id="show2" <?php if($pilihan_jumlah_kaos=='1'){echo "checked";} ?> />  Custom Jumlah 
                    </td>
                    <td>
                      <b id="p2"  <?php if($pilihan_jumlah_kaos=='1'){echo "style='display:block'";}else{echo "style='display:none'";} ?>>
                        <input type="number" min="1"  name="jumlah_custom_kaos" id="jumlah_custom_kaos" style="width:100px;height:30px" value="{{$jumlah_custom}}" /><strong> Dozen </strong>
                      </b>
                    </td>
                  </table>
                    
                    {{$errors->first('jumlah_custom')}}
                    {{$errors->first('jumlah_standar')}}
                    <br><br>
                    </div>
                  </div>
      <b id="titlelabel"><label>Fitur tambahan</label></b> 
        <legend></legend>


        <div class="row">
       <?php $ref = DB::table('ref_additional_features')
              ->where('additional_features_type','Kaos')
              ->get();
        ?>
            @foreach($ref as $ref)
            <div class="col-md-6">
            <input type="checkbox" class="from-control fitur_tambahan_kaos" id="fitur{{$ref->additional_features_id}}" name="{{$ref->additional_features_id}}" value="1"<?php if(Session::get($ref->additional_features_name)=='1'){echo "checked";} ?>> {{$ref->additional_features_name}} Rp {{$ref->additional_features_price}} / {{$ref->additional_features_unit}}</input><br><br>
          </div>
            @endforeach

        </div>



      </div>

         <div class="col-md-5">
             <b id="titlelabel"><label>Perkiraan total biaya</label></b> 
            <legend></legend>
                <div class="row">
                      <div class="col-lg-5">
                    Total biaya
                      </div>
                      <div class="col-lg-6">
                        <span id="span_tshirt_price">Rp 0</span>
                      </div>
                  </div>
            </div>
            <br>
            <br>
            <br>
            <br><br>


      <div class="col-md-5">
         <b id="titlelabel"><label>Data Pemesan</label></b> 
        <legend></legend>
            <div class="row">
                  <div class="col-lg-5">
                Nama pemesan <font color="red">*</font>
                  </div>
                  <div class="col-lg-6">
                  <?php if(Input::Old('nama')<>""){
                        $value = Input::Old('nama');
                        }else{
                        $value = Session::get('nama');
                        }
                  ?>
                    <input type="text"  class="form-control"  name="nama" placeholder="Nama"style="width:250px;height:30px" value="{{$value}}" required /></input>{{$errors->first('nama')}}
                    </div>
                  </div><br>
                  <div class="row">
                  <div class="col-lg-5">
              Email <font color="red">*</font>
              </div>
                  <div class="col-lg-6">
                  <?php if(Input::Old('email')<>""){
                        $value = Input::Old('email');
                        }else{
                        $value = Session::get('email');
                        }
                  ?>
                    <input type="text" class="form-control"  name="email" placeholder="Email"style="width:250px;height:30px" value="{{$value}}" required/></input>{{$errors->first('email')}}
                  </div>
                  </div><br>

                    <div class="row">
                  <div class="col-lg-5">
                    Jenis kelamin <font color="red">*</font>
                    </div>
                  <div class="col-lg-6">
                  <?php
                      if(Input::Old('jenis_kelamin')<>""){
                        $jk = Input::Old('jenis_kelamin');
                        }else{
                        $jk = Session::get('jenis_kelamin');
                        }
                  ?>
              <input type="radio" name="jenis_kelamin" value="Laki-laki" <?php if($jk=='Laki-laki'){echo "checked";} ?> required> Laki-laki</input> <input type="radio" name="jenis_kelamin" value="Perempuan" <?php if($jk=='Perempuan'){echo "checked";} ?>required> Perempuan</input><br>{{$errors->first('jenis_kelamin')}}
                    </div>
                    </div>

                    
                  <br>

                    <div class="row">
                  <div class="col-lg-5">
                    Alamat <font color="red">*</font>
                    </div>
                  <div class="col-lg-6">
                  <?php if(Input::Old('alamat')<>""){
                        $value = Input::Old('alamat');
                        }else{
                        $value = Session::get('alamat');
                        }
                  ?>
                    <textarea class="form-control"  name="alamat" placeholder="Alamat"style="width:250px;height:50px" required>{{$value}}</textarea>{{$errors->first('alamat')}}
            
                    </div>
                    </div>

                  <br>

                    <div class="row">
                  <div class="col-lg-5">
                    No Telepon (kontak) <font color="red">*</font>
                    </div>
                  <div class="col-lg-6">
                  <?php if(Input::Old('kontak')<>""){
                        $value = Input::Old('kontak');
                        }else{
                        $value = Session::get('kontak');
                        }
                  ?>
              <input type="text" class="form-control"  name="kontak" placeholder="No telepon" style="width:250px;height:30px" value="{{$value}}" required/>{{$errors->first('kontak')}}<br>
                    </div>
                    </div>
                    
        <b id="titlelabel"><label>Referensi</label></b>
        <legend></legend>
          <div class="row">
          <div class="col-lg-5">
            Marketing ID (Kode)
          </div>
          <div class="col-lg-6">
            <select class="form-control"  name="marketing_id" style="width:250px;height:30px" />
              <option value="1">MR-SCI-0001</option>
              <option value="2">MR-SCI-0002</option>
            </select>
          </div>
          </div>


   

        <br>
      </div>
      </div>

         

     </div>


      <div class="modal-footer">


<button type="submit" class="btn btn-dark pull-right" id="i_submit4" onclick="get_tshirt_price();" style="width:125px">Simpan</button>{{Form::close()}} <button class="btn btn-dark pull-right" style="width:125px; margin-right:5px" class="close" data-dismiss="modal">Batal</button></a><button class="btn btn-dark" id="cek" style="width:125px" onclick="get_tshirt_price();" >Cek harga</button>
        
      </div>
    </div>
  </div>
</div>


<script type="text/javascript">
   
function get_tshirt_price() {
  var jenis_bahan_kaos = $("#jenis_bahan_kaos").val();
  var pilihan = $('input[name=pilihan_jumlah_kaos]:checked').val(); 
  var jumlah_standar_kaos = $("#jumlah_standar_kaos").val(); 
  var jumlah_custom_kaos = $("#jumlah_custom_kaos").val();

  var arr_fitur_tambahan = {};
  if($('input:checkbox.fitur_tambahan_kaos').length > 0) {
    $('input:checkbox.fitur_tambahan_kaos').each(function () {
      var item_id = $(this).attr('id');
      var item_name = $(this).attr('name');
  var item_value = (this.checked ? $(this).val() : "");
      
      arr_fitur_tambahan[item_id] = {
        'id': item_name, 
        'value': item_value
      };
    });
}
        $.ajax({
            type: 'POST',
            url: "{{URL::to('/pesanproduk/get_tshirt_price')}}",
            data: 'jenis_bahan_kaos=' + jenis_bahan_kaos + 
                  '&pilihan=' + pilihan + 
                  '&jumlah_standar_kaos=' + jumlah_standar_kaos + 
                  '&jumlah_custom_kaos=' + jumlah_custom_kaos + 
                  '&arr_fitur_tambahan=' + JSON.stringify(arr_fitur_tambahan),
            dataType: 'json',
            async: false,
            success: function(product_price) {
                $("#span_tshirt_price").html(product_price);
            }
        });
    //}
}
</script>


<div class="modal fade" id="orderpackaging" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
  <div class="modal-dialog modal-lg" style="width:95%">
    <div class="modal-content">
      <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="margin-right:5px">&times;</button>

      <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:5px">Pesan Packaging</label></h4>
      </div>
     <div align="left">
     <br>
      {{Form::open(array(
            'url' => '/pesanproduk/pesanpackaging',
            'method' => 'POST'
          ))}}
           <div class="row">
      <div class="col-md-5 col-md-offset-1">
         <b id="titlelabel"><label>Data Packaging</label></b> 
        <legend></legend>
      <div class="row">
                  <div class="col-lg-5">
                  Jenis kemasan <font color="red">*</font>
                  </div>
                  <div class="col-lg-7">
                  <table>
                  <td>
                    <select class="form-control" id="jenis_packaging"  name="jenis_packaging" style="width:250px;height:30px" required>
                      <option value="">Silahkan pilih</option>
                      <?php 
                        if(Input::Old('jenis_packaging')<>""){
                        $id = Input::Old('jenis_packaging');
                        }else{
                        $id = Session::get('jenis_packaging');
                        }
                        
                  foreach($jenispackaging as $type){
                    if($type->packaging_type == $id){
                      echo '<option value="'.$type->packaging_type.'" selected>'.$type->packaging_type.'</option>';
                    }else{
                      echo '<option value="'.$type->packaging_type.'">'.$type->packaging_type.'</option>';
                    }
                  }
                        ?>
                    </select>
                  </td>
                  <td>
                      {{$errors->first('jenis_packaging')}}
                  </td>
                </table><br>
                    </div>
                  </div>

                  <div class="row">
                  <div class="col-lg-5">
                  Ukuran <font color="red">*</font>
                  </div>
                  <div class="col-lg-7">
                  <?php
                    if(Input::Old('pilihan_ukuran')<>""){
                        $pilihan_ukuran = Input::Old('pilihan_ukuran');
                        }else{
                        $pilihan_ukuran = Session::get('pilihan_ukuran');
                      }

                      if(Input::Old('length')<>""){
                        $length = Input::Old('length');
                        }else{
                        $length = Session::get('length');
                      }

                      if(Input::Old('width')<>""){
                        $width = Input::Old('width');
                        }else{
                        $width = Session::get('width');
                      }

                      if(Input::Old('height')<>""){
                        $height = Input::Old('height');
                        }else{
                        $height = Session::get('height');
                      }

                      if(Input::Old('ukuran_standar')<>""){
                        $ukuran_standar = Input::Old('ukuran_standar');
                        }else{
                        $ukuran_standar = Session::get('ukuran_standar');
                      }
                  ?>
                    <input type="radio" name="pilihan_ukuran" value="0" id="hide3" <?php if($pilihan_ukuran=='0'){echo "checked";} ?> checked /> Standar (Default)   
                    <br>
                    <table><td>
                     <select class="form-control" id="ukuran_standar_packaging" name="ukuran_standar_packaging" style="width:250px;height:30px" >
                      <option value="">Silahkan pilih</option>
                      <?php 
                  foreach($ukuranpackaging as $size){
                    if($size->packaging_id == $ukuran_standar){
                      echo '<option value="'.$size->packaging_id.'" selected>'.$size->packaging_length.' x '.$size->packaging_width.' x '.$size->packaging_height.'</option>';
                    }else{
                      echo '<option value="'.$size->packaging_id.'">'.$size->packaging_length.' x '.$size->packaging_width.' x '.$size->packaging_height.'</option>';
                    }
                  }
                        ?>
                    </select>
                
                  Panjang x Lebar x Tinggi
                  </td></table>
                    {{$errors->first('ukuran_standar')}}<br>
                        <input type="radio" name="pilihan_ukuran" value="1" id="show3" <?php if($pilihan_ukuran=='1'){echo "checked";} ?> />  Custom  
                        <br>
                        <b id="p3"  <?php if($pilihan_ukuran=='1'){echo "style='display:block'";}else{echo "style='display:none'";} ?>>
                        <input type="text" id="length_packaging" name="length_packaging" style="width:73px;height:30px" value="{{$length}}" /><strong> x </strong>
                        <input type="text" id="width_packaging" name="width_packaging" style="width:73px;height:30px" value="{{$width}}" /><strong> x </strong>
                        <input type="text" id="height_packaging" name="height_packaging" style="width:73px;height:30px" value="{{$height}}" /><strong> Panjang x Lebar x Tinggi </strong>
                        <br>
                        </b>
                      
                    {{Session::get('errorsize')}}
                    <br>
                    </div>
                  </div>

        

                  <div class="row">
                  <div class="col-lg-5">
                 Jenis kertas <font color="red">*</font>
                  </div>
                  <div class="col-lg-7">
                  <table>
                  <td>
                    <select class="form-control" id="jenis_kertas_packaging" name="jenis_kertas_packaging" id="" style="width:250px;height:30px" required>
                      <option value="">Silahkan pilih</option>
                      <?php 
                        if(Input::Old('jenis_kertas')<>""){
                        $jeniskertas = Input::Old('jenis_kertas');
                        }else{
                        $jeniskertas = Session::get('jenis_kertas');
                        }
                  foreach($kertaspackaging as $paper){
                    if($paper->papertype_name == $jeniskertas){
                      echo '<option value="'.$paper->papertype_name.'" selected>'.$paper->papertype_name.'</option>';
                    }else{
                      echo '<option value="'.$paper->papertype_name.'">'.$paper->papertype_name.'</option>';
                    }
                  }
                        ?>
                    </select>
                  </td>
                  <td>
                    {{$errors->first('jenis_kertas')}}
                  </td>
                </table>
                  <br>
                    </div>
                  </div>

                  <div class="row">
                  <div class="col-lg-5">
                   Design<br>
                 (Format *ai, *psd, *jpg, *png, *cdr, max 5MB)
                  </div>
                  <div class="col-lg-7">
                    <input type="file" class="form-control" id="i_file5" name="design_packaging" style="width:250px;height:30px" />
                    <br>
                    </div>
                  </div>

                  <div class="row">
                  <div class="col-lg-5">
                  Jumlah order <font color="red">*</font>
                  </div>
                  <div class="col-lg-7">
                  <?php 
                      if(Input::Old('pilihan_jumlah_packaging')<>""){
                        $pilihan_jumlah_packaging = Input::Old('pilihan_jumlah_packaging');
                        }else{
                        $pilihan_jumlah_packaging = Session::get('pilihan_jumlah_packaging');
                        }

                        if(Input::Old('jumlah_custom')<>""){
                        $jumlah_custom = Input::Old('jumlah_custom');
                        }else{
                        $jumlah_custom = Session::get('jumlah_custom');
                        }

                        if(Input::Old('jumlah_standar')<>""){
                        $jumlah_standar = Input::Old('jumlah_standar');
                        }else{
                        $jumlah_standar = Session::get('jumlah_standar');
                        }
                   ?>
                    <input type="radio"  name="pilihan_jumlah_packaging" value="0" id="hide4" <?php if($pilihan_jumlah_packaging==''){echo "checked";} ?> checked /> Standar (Default)   {{$errors->first('pilihan_jumlah')}}
                    <select  class="form-control" style="width:250px;height:30px" name="jumlah_standar_packaging" id="jumlah_standar_packaging" >
                       
                        <option value="1000">1000</option>
                        <option value="2000">2000</option>
                        <option value="3000">3000</option>
                        <option value="4000">4000</option>
                    </select>
                    <br>
                    <table>
                    <td>
                      <input type="radio" name="pilihan_jumlah_packaging" value="1" id="show4" <?php if($pilihan_jumlah_packaging=='1'){echo "checked";} ?> />  Custom Jumlah 
                    </td>
                    <td>
                      <b id="p4"  <?php if($pilihan_jumlah_packaging=='1'){echo "style='display:block'";}else{echo "style='display:none'";} ?>>
                        <input type="number" min="1000"  name="jumlah_custom_packaging" id="jumlah_custom_packaging" style="width:100px;height:30px" value="{{$jumlah_custom}}" /><strong> Pcs </strong>
                      </b>
                    </td>
                  </table>
                    
                    {{$errors->first('jumlah_custom')}}
                    <br><br>
                    </div>
                  </div>
      <b id="titlelabel"><label>Fitur tambahan</label></b> 
        <legend></legend>


        <div class="row">
       <?php $ref = DB::table('ref_additional_features')
              ->where('additional_features_type','Packaging')
              ->get();
        ?>
            @foreach($ref as $ref)
            <div class="col-md-6">
            <input type="checkbox" class="from-control fitur_tambahan_packaging" id="fitur{{$ref->additional_features_id}}" name="{{$ref->additional_features_id}}" value="1"<?php if(Session::get($ref->additional_features_name)=='1'){echo "checked";} ?>> {{$ref->additional_features_name}} Rp {{$ref->additional_features_price}} / {{$ref->additional_features_unit}}</input><br><br>
          </div>
            @endforeach

        </div>



      </div>

         <div class="col-md-5">
             <b id="titlelabel"><label>Perkiraan total biaya</label></b> 
            <legend></legend>
                <div class="row">
                      <div class="col-lg-5">
                    Total biaya
                      </div>
                      <div class="col-lg-6">
                        <span id="span_packaging_price">Rp 0</span>
                      </div>
                  </div>
            </div>
            <br>
            <br>
            <br>
            <br><br>



      <div class="col-md-5">
         <b id="titlelabel"><label>Data Pemesan</label></b> 
        <legend></legend>
            <div class="row">
                  <div class="col-lg-5">
                Nama pemesan <font color="red">*</font>
                  </div>
                  <div class="col-lg-6">
                  <?php if(Input::Old('nama')<>""){
                        $value = Input::Old('nama');
                        }else{
                        $value = Session::get('nama');
                        }
                  ?>
                    <input type="text"  class="form-control"  name="nama" placeholder="Nama"style="width:250px;height:30px" value="{{$value}}"  required/></input>{{$errors->first('nama')}}
                    </div>
                  </div><br>
                  <div class="row">
                  <div class="col-lg-5">
              Email <font color="red">*</font>
              </div>
                  <div class="col-lg-6">
                  <?php if(Input::Old('email')<>""){
                        $value = Input::Old('email');
                        }else{
                        $value = Session::get('email');
                        }
                  ?>
                    <input type="text" class="form-control"  name="email" placeholder="Email"style="width:250px;height:30px" value="{{$value}}" required/></input>{{$errors->first('email')}}
                  </div>
                  </div><br>

                    <div class="row">
                  <div class="col-lg-5">
                    Jenis kelamin <font color="red">*</font>
                    </div>
                  <div class="col-lg-6">
                  <?php
                      if(Input::Old('jenis_kelamin')<>""){
                        $jk = Input::Old('jenis_kelamin');
                        }else{
                        $jk = Session::get('jenis_kelamin');
                        }
                  ?>
              <input type="radio" name="jenis_kelamin" value="Laki-laki" <?php if($jk=='Laki-laki'){echo "checked";} ?> required> Laki-laki</input> <input type="radio" name="jenis_kelamin" value="Perempuan" <?php if($jk=='Perempuan'){echo "checked";} ?> required> Perempuan</input><br>{{$errors->first('jenis_kelamin')}}
                    </div>
                    </div>

                    
                  <br>

                    <div class="row">
                  <div class="col-lg-5">
                    Alamat <font color="red">*</font>
                    </div>
                  <div class="col-lg-6">
                  <?php if(Input::Old('alamat')<>""){
                        $value = Input::Old('alamat');
                        }else{
                        $value = Session::get('alamat');
                        }
                  ?>
                    <textarea class="form-control"  name="alamat" placeholder="Alamat"style="width:250px;height:50px" required>{{$value}}</textarea>{{$errors->first('alamat')}}
            
                    </div>
                    </div>

                  <br>

                    <div class="row">
                  <div class="col-lg-5">
                    No Telepon (kontak) <font color="red">*</font>
                    </div>
                  <div class="col-lg-6">
                  <?php if(Input::Old('kontak')<>""){
                        $value = Input::Old('kontak');
                        }else{
                        $value = Session::get('kontak');
                        }
                  ?>
              <input type="text" class="form-control"  name="kontak" placeholder="No telepon" style="width:250px;height:30px" value="{{$value}}" required/>{{$errors->first('kontak')}}<br>
                    </div>
                    </div>
                    
        <b id="titlelabel"><label>Referensi</label></b>
        <legend></legend>
          <div class="row">
          <div class="col-lg-5">
            Marketing ID (Kode)
          </div>
          <div class="col-lg-6">
            <select class="form-control"  name="marketing_id" style="width:250px;height:30px" required/>
              <option value="1">MR-SCI-0001</option>
              <option value="2">MR-SCI-0002</option>
            </select>
          </div>
          </div>




        <br>
      </div>
      </div>

         

     </div>


      <div class="modal-footer">


<button type="submit" onclick="get_packaging_price();" id="i_submit5" class="btn btn-dark pull-right" style="width:125px">Simpan</button>{{Form::close()}} <button class="btn btn-dark pull-right" style="width:125px; margin-right:5px" class="close" data-dismiss="modal">Batal</button></a><button class="btn btn-dark" id="cek" style="width:125px" onclick="get_packaging_price();" >Cek harga</button>
          
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">
function get_packaging_price() {
  var jenis_packaging = $("#jenis_packaging").val();
  var jenis_kertas_packaging = $("#jenis_kertas_packaging").val(); 
  var pilihan_jumlah = $('input[name=pilihan_jumlah_packaging]:checked').val(); 
  var pilihan_ukuran = $('input[name=pilihan_ukuran]:checked').val(); 

  var ukuran_standar_packaging = $("#ukuran_standar_packaging").val(); 
  var length_packaging = $("#length_packaging").val(); 
  var width_packaging = $("#width_packaging").val(); 
  var height_packaging = $("#height_packaging").val(); 

  var jumlah_standar_packaging = $("#jumlah_standar_packaging").val(); 
  var jumlah_custom_packaging = $("#jumlah_custom_packaging").val(); 

  var arr_fitur_tambahan = {};
  if($('input:checkbox.fitur_tambahan_packaging').length > 0) {
    $('input:checkbox.fitur_tambahan_packaging').each(function () {
      var item_id = $(this).attr('id');
      var item_name = $(this).attr('name');
  var item_value = (this.checked ? $(this).val() : "");
      
      arr_fitur_tambahan[item_id] = {
        'id': item_name, 
        'value': item_value
      };
    });
}
        $.ajax({
            type: 'POST',
            url: "{{URL::to('/pesanproduk/get_packaging_price')}}",
            data: 'jenis_packaging=' + jenis_packaging + 
                  '&jenis_kertas_packaging=' + jenis_kertas_packaging + 
                  '&ukuran_standar_packaging=' + ukuran_standar_packaging + 
                  '&pilihan_jumlah=' + pilihan_jumlah + 
                  '&pilihan_ukuran=' + pilihan_ukuran + 
                  '&length_packaging=' + length_packaging + 
                  '&width_packaging=' + width_packaging + 
                  '&height_packaging=' + height_packaging + 
                  '&jumlah_standar_packaging=' + jumlah_standar_packaging + 
                  '&jumlah_custom_packaging=' + jumlah_custom_packaging + 
                  '&arr_fitur_tambahan=' + JSON.stringify(arr_fitur_tambahan),
            dataType: 'json',
            async: false,
            success: function(product_price) {
                $("#span_packaging_price").html(product_price);
            }
        });
    //}
}
</script>





<script type="text/javascript">
    $("#jenis_cetak").change(function() {
          if ($(this).find("option:selected").attr("id") == "") {
            $("#jenis_kertas").val('');
            $("#brosur_size").val('');
               <?php foreach($brosursize as $bsize){ ?>
                $("#brosur{{$bsize->size_brochure_size_id}}").hide();
            <?php }

            foreach($letterheadsize as $lsize){ ?>
                $("#letterhead{{$lsize->size_letterhead_size_id}}").hide();
            <?php } 

            foreach($envelopesize as $esize){ ?>
                $("#envelope{{$esize->size_envelope_size_id}}").hide();
            <?php } 

            foreach($flayersize as $fsize){ ?>
                $("#flayer{{$fsize->size_flayer_size_id}}").hide();
            <?php }


            foreach($brosurkertas as $bkertas){ ?>
                $("#brosurkertas{{$bkertas->papertype_id}}").hide();
            <?php }

            foreach($letterheadkertas as $lkertas){ ?>
                $("#letterheadkertas{{$lkertas->papertype_id}}").hide();
            <?php } 

            foreach($envelopekertas as $ekertas){ ?>
                $("#envelopekertas{{$ekertas->papertype_id}}").hide();
            <?php } 

            foreach($flayerkertas as $fkertas){ ?>
                $("#flayerkertas{{$fkertas->papertype_id}}").hide();
            <?php } ?>


          } else if ($(this).find("option:selected").attr("id") == "brochure") {
      $("#jenis_kertas").val('');
            $("#brosur_size").val('');
            <?php foreach($brosursize as $bsize){ ?>
                $("#brosur{{$bsize->size_brochure_size_id}}").show();
            <?php }

            foreach($letterheadsize as $lsize){ ?>
                $("#letterhead{{$lsize->size_letterhead_size_id}}").hide();
            <?php } 

            foreach($envelopesize as $esize){ ?>
                $("#envelope{{$esize->size_envelope_size_id}}").hide();
            <?php } 

            foreach($flayersize as $fsize){ ?>
                $("#flayer{{$fsize->size_flayer_size_id}}").hide();
            <?php } 


            foreach($brosurkertas as $bkertas){ ?>
                $("#brosurkertas{{$bkertas->papertype_id}}").show();
            <?php }

            foreach($letterheadkertas as $lkertas){ ?>
                $("#letterheadkertas{{$lkertas->papertype_id}}").hide();
            <?php } 

            foreach($envelopekertas as $ekertas){ ?>
                $("#envelopekertas{{$ekertas->papertype_id}}").hide();
            <?php } 

            foreach($flayerkertas as $fkertas){ ?>
                $("#flayerkertas{{$fkertas->papertype_id}}").hide();
            <?php } ?>



          } else if ($(this).find("option:selected").attr("id") == "letterhead") {
            $("#jenis_kertas").val('');
            $("#brosur_size").val('');
             <?php foreach($brosursize as $bsize){ ?>
                $("#brosur{{$bsize->size_brochure_size_id}}").hide();
            <?php }

            foreach($letterheadsize as $lsize){ ?>
                $("#letterhead{{$lsize->size_letterhead_size_id}}").show();
            <?php } 

            foreach($envelopesize as $esize){ ?>
                $("#envelope{{$esize->size_envelope_size_id}}").hide();
            <?php } 

            foreach($flayersize as $fsize){ ?>
                $("#flayer{{$fsize->size_flayer_size_id}}").hide();
            <?php } 


            foreach($brosurkertas as $bkertas){ ?>
                $("#brosurkertas{{$bkertas->papertype_id}}").hide();
            <?php }

            foreach($letterheadkertas as $lkertas){ ?>
                $("#letterheadkertas{{$lkertas->papertype_id}}").show();
            <?php } 

            foreach($envelopekertas as $ekertas){ ?>
                $("#envelopekertas{{$ekertas->papertype_id}}").hide();
            <?php } 

            foreach($flayerkertas as $fkertas){ ?>
                $("#flayerkertas{{$fkertas->papertype_id}}").hide();
            <?php } ?>



          } else if ($(this).find("option:selected").attr("id") == "envelope") {
            $("#jenis_kertas").val('');
            $("#brosur_size").val('');
             <?php foreach($brosursize as $bsize){ ?>
                $("#brosur{{$bsize->size_brochure_size_id}}").hide();
            <?php }

            foreach($letterheadsize as $lsize){ ?>
                $("#letterhead{{$lsize->size_letterhead_size_id}}").hide();
            <?php } 

            foreach($envelopesize as $esize){ ?>
                $("#envelope{{$esize->size_envelope_size_id}}").show();
            <?php } 

            foreach($flayersize as $fsize){ ?>
                $("#flayer{{$fsize->size_flayer_size_id}}").hide();
            <?php } 


            foreach($brosurkertas as $bkertas){ ?>
                $("#brosurkertas{{$bkertas->papertype_id}}").hide();
            <?php }

            foreach($letterheadkertas as $lkertas){ ?>
                $("#letterheadkertas{{$lkertas->papertype_id}}").hide();
            <?php } 

            foreach($envelopekertas as $ekertas){ ?>
                $("#envelopekertas{{$ekertas->papertype_id}}").show();
            <?php } 

            foreach($flayerkertas as $fkertas){ ?>
                $("#flayerkertas{{$fkertas->papertype_id}}").hide();
            <?php } ?>



          } else if ($(this).find("option:selected").attr("id") == "flayer") {
             $("#jenis_kertas").val('');
            $("#brosur_size").val('');
              <?php foreach($brosursize as $bsize){ ?>
                $("#brosur{{$bsize->size_brochure_size_id}}").hide();
            <?php }

            foreach($letterheadsize as $lsize){ ?>
                $("#letterhead{{$lsize->size_letterhead_size_id}}").hide();
            <?php } 

            foreach($envelopesize as $esize){ ?>
                $("#envelope{{$esize->size_envelope_size_id}}").hide();
            <?php } 

            foreach($flayersize as $fsize){ ?>
                $("#flayer{{$fsize->size_flayer_size_id}}").show();
            <?php } 


            foreach($brosurkertas as $bkertas){ ?>
                $("#brosurkertas{{$bkertas->papertype_id}}").hide();
            <?php }

            foreach($letterheadkertas as $lkertas){ ?>
                $("#letterheadkertas{{$lkertas->papertype_id}}").hide();
            <?php } 

            foreach($envelopekertas as $ekertas){ ?>
                $("#envelopekertas{{$ekertas->papertype_id}}").hide();
            <?php } 

            foreach($flayerkertas as $fkertas){ ?>
                $("#flayerkertas{{$fkertas->papertype_id}}").show();
            <?php } ?>
          }
    });
</script>

<script type="text/javascript">

    $('#i_submit1').click( function() {
        //check whether browser fully supports all File API
        if (window.File && window.FileReader && window.FileList && window.Blob)
        {
            //get the file size and file type from file input field
            var fsize = $('#i_file1')[0].files[0].size;
           
            if(fsize>5097152) //do something if file size more than 1 mb (1048576)
            {
                setTimeout(function(){
               alert("File desain terlalu besar\nSilahkan ganti!");
            }, 1000);
                return false; 
            }
        }else{
            alert("Please upgrade your browser, because your current browser lacks some new features we need!");
        }
    });


     $('#i_submit2').click( function() {
        //check whether browser fully supports all File API
        if (window.File && window.FileReader && window.FileList && window.Blob)
        {
            //get the file size and file type from file input field
            var fsize = $('#i_file2')[0].files[0].size;
           
            if(fsize>5097152) //do something if file size more than 1 mb (1048576)
            {
                setTimeout(function(){
               alert("File desain terlalu besar\nSilahkan ganti!");
            }, 1000);
                return false; 
            }
        }else{
            alert("Please upgrade your browser, because your current browser lacks some new features we need!");
        }
    });


      $('#i_submit3').click( function() {
        //check whether browser fully supports all File API
        if (window.File && window.FileReader && window.FileList && window.Blob)
        {
            //get the file size and file type from file input field
            var fsize = $('#i_file3')[0].files[0].size;
           
            if(fsize>5097152) //do something if file size more than 1 mb (1048576)
            {
                setTimeout(function(){
               alert("File desain terlalu besar\nSilahkan ganti!");
            }, 1000);
                return false; 
            }
        }else{
            alert("Please upgrade your browser, because your current browser lacks some new features we need!");
        }
    });


       $('#i_submit4').click( function() {
        //check whether browser fully supports all File API
        if (window.File && window.FileReader && window.FileList && window.Blob)
        {
            //get the file size and file type from file input field
            var fsize = $('#i_file4')[0].files[0].size;
           
            if(fsize>5097152) //do something if file size more than 1 mb (1048576)
            {
                setTimeout(function(){
               alert("File desain terlalu besar\nSilahkan ganti!");
            }, 1000);
                return false; 
            }
        }else{
            alert("Please upgrade your browser, because your current browser lacks some new features we need!");
        }
    });


        $('#i_submit5').click( function() {
        //check whether browser fully supports all File API
        if (window.File && window.FileReader && window.FileList && window.Blob)
        {
            //get the file size and file type from file input field
            var fsize = $('#i_file5')[0].files[0].size;
           
            if(fsize>5097152) //do something if file size more than 1 mb (1048576)
            {
                setTimeout(function(){
               alert("File desain terlalu besar\nSilahkan ganti!");
            }, 1000);
                return false; 
            }
        }else{
            alert("Please upgrade your browser, because your current browser lacks some new features we need!");
        }
    });


  </script>
@stop
@stop
     